﻿namespace Yoozoo.Modules.Download
{

    /// <summary>
    /// 下载时预分配的Buffer
    /// </summary>
    public class PreAllocatedBuffer
    {
        // https://docs.unity3d.com/ScriptReference/Networking.DownloadHandler.ReceiveData.html
        // https://docs.unity3d.com/ScriptReference/Networking.DownloadHandlerScript-ctor.html
        // 文档中只说了ReceiveData每帧调用一次，没说Buffer满了会怎么处理
        // 也许可以用Buffer大小来限制下载速度，先预留一个接口
        // 测试下来并不能限速

        public readonly byte[] Buffer;

        public PreAllocatedBuffer(int size = 1024 * 1024)
        {
            Buffer = new byte[size];
        }
    }
}
